package fcrpt

class ProductsInController {
    def dynamicQueryService
    def productsIn(){
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def tableHeadList=[]
        def productsIn=[]
        def pageSizeList = [10,20,50,100]
        def totalCount =0
        if(params.EXPORT_CONTENT_NAME=='Excel'){
            params.SYS_QUERY_NAME = 'productsIn'
            productsIn = dynamicQueryService.queryForList(params)
            if (productsIn.size() > 0) {
                tableHeadList = productsIn[0].keySet()
            }
            params.SYS_QUERY_NAME = 'productsInCount'
            totalCount = dynamicQueryService.queryForList(params)[0].TOTALCOUNT
        }

        [startno:params.startno?:'',
         endno:params.endno?:'',
         pageSize:pageSize,
         totalCount: totalCount,
         pageSizeList: pageSizeList,
         tableHeadList:tableHeadList,
         productsIn:productsIn,
         lotId:params.lotId?:'',
         type:params.type?:'',
         startTimeOut:params.startTimeOut?:'',
         endTimeInOut:params.endTimeInOut?:'',
         startTimeIn:params.startTimeIn?:'',
         endTimeIn:params.endTimeIn?:'',
         partName:params.partName?:'',
         tuhao:params.tuhao?:''
        ]
    }
}
